package com.kd.service.recruiter.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kd.bean.recruiter.Recruiter_basic;
import com.kd.bean.recruiter.Recruitment_msg;
import com.kd.dao.recruiter.IRecruiter_basicDao;
import com.kd.dao.recruiter.IRecruitment_msgDao;
import com.kd.service.recruiter.IRecruiter_basicService;

/**
 * 招聘者 基本资料(recruiter_basic)
 * @author ZFC
 *
 */
@Service
@Transactional
public class Recruiter_basicServiceImpl implements IRecruiter_basicService{

	@Autowired
	private IRecruiter_basicDao recDao;
	
	@Autowired
	private IRecruitment_msgDao msgDao;
	
	@Override
	public PageInfo<Recruiter_basic> queryAllBasicMessgae(Integer pageNum, Integer pageSize) throws Exception {
		PageHelper.startPage(pageNum, pageSize);
		List<Recruiter_basic> list = recDao.queryAllBasicMessgae();
		PageInfo<Recruiter_basic> info = new PageInfo<>(list);
		return info;
	}

	@Override
	public PageInfo<Recruiter_basic> queryBasicMessgaeByStatei(Integer pageNum, Integer pageSize) throws Exception {
		PageHelper.startPage(pageNum, pageSize);
		List<Recruiter_basic> list = recDao.queryBasicMessgaeByStatei();
		PageInfo<Recruiter_basic> info = new PageInfo<>(list);
		return info;
	}

	@Override
	public Boolean updateBasicState(Integer recruiter_id, Integer recruiter_statei) throws Exception {
		
		return recDao.updateBasicState(recruiter_id, recruiter_statei)>0;
	}

	@Override
	public Integer queryRecPersonCount() throws Exception {
		
		return recDao.queryRecPersonCount();
	}

	@Override
	public Recruiter_basic basicLogin(Recruiter_basic basic) throws Exception {
		
		return recDao.basicLogin(basic);
	}

	@Override
	public Boolean basicRegister(Recruiter_basic basic) throws Exception {
		
		return recDao.basicRegister(basic)>0;
	}

	@Override
	public Recruiter_basic queryPwd(Recruiter_basic basic) throws Exception {
		
		return recDao.queryPwd(basic);
	}

	@Override
	public Boolean updteBasic(Recruiter_basic basic) throws Exception {
		Boolean flag = recDao.updteBasic(basic)>0;
		if(flag) {
			//修改成功
			//旗下招聘信息
			msgDao.updateRecNameAndPhone(basic);
		}
		return flag;
	}

	@Override
	public Boolean updateBasicOfCompany(Integer company_id, Integer recruiter_id) {
		
		return recDao.updateBasicOfCompany(company_id, recruiter_id)>0;
	}

	@Override
	public Boolean updateBasicPwd(String recruiter_ps, Integer recruiter_id) {
		
		return recDao.updateBasicPwd(recruiter_ps, recruiter_id)>0;
	}

	@Override
	public Recruiter_basic queryByRecruiter_id(Integer recruiter_id) throws Exception {
		
		return recDao.queryByRecruiter_id(recruiter_id);
	}


}
